package cn.ratel.component;

import cn.ratel.aop.MethodInvocation;

import java.util.ArrayList;
import java.util.List;

public class Enhancers {
	private static final List<Enhancer> globalEnhancers = new ArrayList<>();
	private static final List<Enhancer> globalInterceptors = new ArrayList<>();

	private Enhancers() {
	}

	private static Enhancers me = new Enhancers();

	public static Enhancers me() {
		return me;
	}

	public void addGlobalEnhancer(Enhancer Enhancer) {
		globalEnhancers.add(Enhancer);
	}

	public List<Enhancer> getGlobalEnhancers() {
		return globalEnhancers;
	}

	public void addGlobalInterceptor(Enhancer Enhancer) {
		globalInterceptors.add(Enhancer);
	}

	public List<Enhancer> getGlobalInterceptors() {
		return globalInterceptors;
	}

	public interface Enhancer {
		void enhance(MethodInvocation invocation);
	}
}
